COMPILER = ghc
FLAGS = 
BIN_DIR = bin 
BIN_NAME = ghcalc-main

ghcalc-main : ghcalc_main.hs parseutils.hs ghcalc_utils.hs
	$(COMPILER) --make -o $(BIN_NAME)  $(FLAGS) ghcalc_main.hs -v parseutils.hs ghcalc_utils.hs

.PHONY:
install : make_dir bin glade
	@echo "Installation Complete!"

.PHONY:
make_dir :
	@if [ -d $$HOME/bin ]; then echo $$HOME/bin exists; else echo \"Creating bin directory in HOME folder\" && mkdir $$HOME/bin ;fi

bin :
	@echo "Copying ghcalc binary into bin folder"
	@cp $(BIN_NAME) $$HOME/bin

.PHONY:
glade :
	@echo "Copying glade file into bin folder"
	@cp ghcalc.glade $$HOME/bin
	@echo "The calculator won't work without this file :).Do not remove it from bin directory"

.PHONY:
clean :
	rm -rf *.hi
	rm -rf *.o
	rm $(BIN_NAME)	
		
